/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Componentes;

import java.awt.Dimension;
import javax.swing.JComboBox;


public class ComboBox extends JComboBox{
    
    public ComboBox() {
        this.setEditable(true);
        AutoCompletion autoCompletion = new AutoCompletion(this);
    }
    
    private boolean realSize;
    @Override
    public Dimension getSize() {
        Dimension size = super.getSize();
        if (realSize) {
            return size;
        }
        Dimension pref_size = getPreferredSize();
        if (pref_size.width < size.width) {
            pref_size.width = size.width;
        }
        return pref_size;
    }
    @Override
    public void doLayout() {
        realSize = true;
        super.doLayout();
        realSize = false;
    }
 
}
